package com.yanqu.road.entity.kowloon;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;
import com.yanqu.road.entity.kowloon.sanxiao.KowloonGameData;

import java.sql.Types;


/**
 * 九龙城寨用户数据
 */
@FieldTypeAnnotation(tableName = "t_u_kowloon_user_data", desc = "九龙城寨用户数据")
public class KowloonUserData extends DataObject {

    @FieldTypeAnnotation(desc = "用户ID", select = true, update = true)
    private long userId;

    @FieldTypeAnnotation(desc = "繁华度")
    private long prosperousValue;

    @FieldTypeAnnotation(desc = "关卡id")
    private int chapterId;

    @FieldTypeAnnotation(desc = "士气等级")
    private int moraleLevel;

    @FieldTypeAnnotation(desc = "当前士气等级是否突破")
    private boolean moraleBroken;

    @FieldTypeAnnotation(desc = "本周加速次数")
    private int speedTimes;

    @FieldTypeAnnotation(desc = "加速重置时间")
    private long speedResetTime;

    @FieldTypeAnnotation(desc = "累计收益")
    private String incomeReward = "";

    @FieldTypeAnnotation(desc = "上次结算收益时间")
    private long lastSettlementRewardTime;

    @FieldTypeAnnotation(desc = "上次领取收益时间")
    private long lastGetRewardTime;

    @FieldTypeAnnotation(desc = "引导状态")
    private int guideBit;

    @FieldTypeAnnotation(desc = "更新时间")
    private long updateTime;

    @FieldTypeAnnotation(desc = "三消盘面", sqlType = Types.LONGVARCHAR)
    private KowloonGameData gameData = null;

    @FieldTypeAnnotation(desc = "今日挑战次数")
    private int challengeTimes;

    @FieldTypeAnnotation(desc = "挑战次数恢复时间")
    private long challengeResetTime;


    public long getUserId() {
        return userId;
    }
    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public long getProsperousValue() {
        return prosperousValue;
    }
    public void setProsperousValue(long prosperousValue) {
        if (this.prosperousValue != prosperousValue) {
            this.prosperousValue = prosperousValue;
            setOp(DataStatus.Update);
        }
    }

    public int getChapterId() {
        return chapterId;
    }
    public void setChapterId(int chapterId) {
        if (this.chapterId != chapterId) {
            this.chapterId = chapterId;
            setOp(DataStatus.Update);
        }
    }

    public int getMoraleLevel() {
        return moraleLevel;
    }
    public void setMoraleLevel(int moraleLevel) {
        if (this.moraleLevel != moraleLevel) {
            this.moraleLevel = moraleLevel;
            setOp(DataStatus.Update);
        }
    }

    public boolean isMoraleBroken() {
        return moraleBroken;
    }

    public void setMoraleBroken(boolean moraleBroken) {
        if (this.moraleBroken != moraleBroken) {
            this.moraleBroken = moraleBroken;
            setOp(DataStatus.Update);
        }
    }

    public int getSpeedTimes() {
        return speedTimes;
    }
    public void setSpeedTimes(int speedTimes) {
        if (this.speedTimes != speedTimes) {
            this.speedTimes = speedTimes;
            setOp(DataStatus.Update);
        }
    }

    public long getSpeedResetTime() {
        return speedResetTime;
    }

    public void setSpeedResetTime(long speedResetTime) {
        if (this.speedResetTime != speedResetTime) {
            this.speedResetTime = speedResetTime;
            setOp(DataStatus.Update);
        }
    }

    public String getIncomeReward() {
        return incomeReward;
    }
    public void setIncomeReward(String incomeReward) {
        if (incomeReward == null){
            return;
        }
        if (this.incomeReward == null || !this.incomeReward.equals(incomeReward)) {
            this.incomeReward = incomeReward;
            setOp(DataStatus.Update);
        }
    }

    public long getLastSettlementRewardTime() {
        return lastSettlementRewardTime;
    }
    public void setLastSettlementRewardTime(long lastSettlementRewardTime) {
        if (this.lastSettlementRewardTime != lastSettlementRewardTime) {
            this.lastSettlementRewardTime = lastSettlementRewardTime;
            setOp(DataStatus.Update);
        }
    }

    public long getLastGetRewardTime() {
        return lastGetRewardTime;
    }
    public void setLastGetRewardTime(long lastGetRewardTime) {
        if (this.lastGetRewardTime != lastGetRewardTime) {
            this.lastGetRewardTime = lastGetRewardTime;
            setOp(DataStatus.Update);
        }
    }

    public long getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(long updateTime) {
        if (this.updateTime != updateTime) {
            this.updateTime = updateTime;
            setOp(DataStatus.Update);
        }
    }

    public KowloonGameData getGameData() {
        return gameData;
    }

    public void setGameData(KowloonGameData gameData) {
        this.gameData = gameData;
        setUpdateOption();
    }

    public int getGuideBit() {
        return guideBit;
    }

    public void setGuideBit(int guideBit) {
        if (this.guideBit != guideBit) {
            this.guideBit = guideBit;
            setOp(DataStatus.Update);
        }
    }

    public int getChallengeTimes() {
        return challengeTimes;
    }

    public void setChallengeTimes(int challengeTimes) {
        if (this.challengeTimes != challengeTimes) {
            this.challengeTimes = challengeTimes;
            setOp(DataStatus.Update);
        }
    }

    public long getChallengeResetTime() {
        return challengeResetTime;
    }

    public void setChallengeResetTime(long challengeResetTime) {
        if (this.challengeResetTime != challengeResetTime) {
            this.challengeResetTime = challengeResetTime;
            setOp(DataStatus.Update);
        }
    }

    /**
     * 获取波次
     */
    public int getSectionId() {
        return gameData == null ? 0 : gameData.getSectionId();
    }
}
